
#include <iostream>
#include <string>

#include "XSD/UserOps.h"
#include "NoNS/all-include.h"

    

int main (int argc, char**argv)
{
  XSD_USER_OPS::xsd_main(argc, argv);
}

DOM::Document* createXsdDocument(bool buildTree)
{
  NoNS::Document* xsdDoc = new NoNS::Document(buildTree);
    
  return xsdDoc;
}

DOM::Document* createXsdDocument(string inFilePath)
{
  XPlusFileInputStream is;
  is.open(inFilePath.c_str(), ios::binary);

  NoNS::Document* xsdDoc = new NoNS::Document(false);

  is >> *xsdDoc; 
  return xsdDoc;
}

//
// Following functions are templates.
// You need to put code in the context
//

    

// template function to populate the Tree with values
void populateDocument(DOM::Document* pDoc)
{
  NoNS::Document* xsdDoc = dynamic_cast<NoNS::Document *>(pDoc);
  // write code to populate the Document here
  NoNS::doc* pdoc = xsdDoc->element_doc();
  pdoc->set_count_choiceList(2);

  List<NoNS::doc::elem_ptr>  choice1ElemList = pdoc->choice_at(0)->choose_list_elem(2);
  choice1ElemList.at(0)->stringValue("123");
  choice1ElemList.at(1)->stringValue("234");

  List<NoNS::doc::elem_ptr>  choice2ElemList = pdoc->choice_at(1)->choose_list_elem(1);
  choice2ElemList.at(0)->stringValue("789");

}

void updateOrConsumeDocument(DOM::Document* pDoc)
{
  NoNS::Document* xsdDoc = dynamic_cast<NoNS::Document *>(pDoc);
  // write code to operate on the populated-Document here

}

  
